package com.fingard.dsp.bank.reqrespobj.billpool;

import com.fingard.dsp.bank.reqrespobj.ReqRespHeader;
import com.fingard.dsp.bank.reqrespobj.RetAtsBase;
import com.fingard.dsp.bank.reqrespobj.billpool.Detail.RetAtsB305DealStateQryDetail;
import com.fingard.xml.XmlTextWriter;

/*交易状态查询，暂时为空
* */
public class RetAtsB305DealStateQry extends RetAtsBase {
    public String respCode;
    public String respInfo;
    //请求时的查询的流水号
    public String relatetrnuid;

    public RetAtsB305DealStateQry(ReqRespHeader p_header) {
        retHeader = p_header;
        retXmlWriter = new XmlTextWriter();
    }

    public void writeRetDetail(RetAtsB305DealStateQryDetail p_retDetail) throws Exception {
        retXmlWriter.writeStartElement("DetailRecord");
        retXmlWriter.writeElementString("Indx", p_retDetail.indx);
        retXmlWriter.writeElementString("State", p_retDetail.state);
        retXmlWriter.writeElementString("Msg", p_retDetail.msg);
        retXmlWriter.writeElementString("Billcode", p_retDetail.billcode);
        retXmlWriter.writeEndElement();
    }

    private boolean hasWrittenBefore = false;

    public void writeBeforeDetail() throws Exception {
        if (hasWrittenBefore) {
            throw new Exception("writeBeforeDetail已被调用过");
        }
        writeStart();
        retXmlWriter.writeElementString("RespCode", respCode);
        retXmlWriter.writeElementString("RespInfo", respInfo);
        retXmlWriter.writeElementString("Relatetrnuid", relatetrnuid);
        hasWrittenBefore = true;
    }

    public void writeAfterDetail() throws Exception {
        if (!hasWrittenBefore) {
            writeBeforeDetail();
        }
        writeEnd();// 写结束
    }
}
